package com.alex.demo.controller;

import com.alex.demo.lock.ZKLock;
import com.alex.demo.service.ZKLockService;
import lombok.extern.slf4j.Slf4j;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.recipes.locks.InterProcessMutex;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

@RestController
@Slf4j
public class ZKLockController {

    @Autowired
    private ZKLockService zkLockService;

    @GetMapping("zkLock")
    public String zkLock(){
        return zkLockService.zkLock();
    }

    @GetMapping("curatorLock")
    public String curatorLock(){
        return zkLockService.curatorLock();
    }

}
